import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.concurrent.Semaphore;
import java.util.concurrent.CountDownLatch;
import java.util.ArrayList;
import java.util.Random;

public class RoachRunner {
	static public class Edge {
		public int capasity;
		public int end;
		public Semaphore semaphore;

		Edge(int c, int e) {
			this.capasity = c;
			this.end = e;
			this.semaphore = new Semaphore(c);
		}
	}

	private static class Roach implements Runnable {
		private int RoachNumber;
		private CountDownLatch RoachLatch;

		public Roach(CountDownLatch cdl, int num) {
			this.RoachLatch = cdl;
			this.RoachNumber = num;
		}

		@Override
		public void run() {
			Random way = new Random();
			int standing = Start;
			writer.println("The Roach №" + RoachNumber + " was born");
			while (standing != Finish) {
				if (vertexes.get(standing).size() == 0) {
					System.out.println("The Roach №" + RoachNumber
							+ " is locked");
					break;
				}
				int randWay = way.nextInt(vertexes.get(standing).size());
				writer.println("The Roach №" + RoachNumber
						+ " going to crowl from " + standing + " to "
						+ vertexes.get(standing).get(randWay).end);
				try {
					vertexes.get(standing).get(randWay).semaphore.acquire();
				} catch (InterruptedException e) {
					writer.println("The Roach ¹" + RoachNumber + " was crushed");
               break;
				}
				try {
					System.out.println("The Roach №" + RoachNumber
							+ " has began to crowl from " + standing + " to "
							+ vertexes.get(standing).get(randWay).end);
					Thread.sleep(way.nextInt(5000));
					System.out.println("The Roach №" + RoachNumber
							+ " has reached "
							+ vertexes.get(standing).get(randWay).end);
				} catch (InterruptedException e) {
					System.out.println("The Roach №" + RoachNumber
							+ " was crushed");
					break;
				} finally {
					vertexes.get(standing).get(randWay).semaphore.release();
				}
				standing = vertexes.get(standing).get(randWay).end;
			}
			writer.println("The Roach ¹" + RoachNumber
					+ " accomplished its mission");
			RoachLatch.countDown();
		}

	}

	public static PrintWriter writer;
	public static ArrayList<ArrayList<Edge>> vertexes = new ArrayList<ArrayList<Edge>>();
	public static int Start;
	public static int Finish;

	public static void main(String[] args) throws IOException,
			InterruptedException {
		writer = new PrintWriter("bugrace.out");
		BufferedReader in = new BufferedReader(new FileReader("bugrace.in"));
		String text = in.readLine();
		StringTokenizer st = new StringTokenizer(text);
		int VertexCount = Integer.valueOf(st.nextToken());
		int BugCount = Integer.valueOf(st.nextToken());
		Start = Integer.valueOf(st.nextToken());
		Finish = Integer.valueOf(st.nextToken());
		for (int i = 0; i < VertexCount; i++)
			vertexes.add(new ArrayList<Edge>());
		for (int i = 0; i < VertexCount; i++) {
			String text2 = in.readLine();
			StringTokenizer st2 = new StringTokenizer(text2);
			for (int j = 0; j < VertexCount; j++) {
				int c = Integer.valueOf(st2.nextToken());
				if (c != 0)
					vertexes.get(i).add(new Edge(c, j));
			}
		}
		CountDownLatch latch = new CountDownLatch(BugCount);
		ArrayList<Roach> bugs = new ArrayList<Roach>();
		for (int i = 0; i < BugCount; i++) {
			bugs.add(new Roach(latch, i + 1));
			new Thread(bugs.get(i)).start();
		}
		latch.await();
		in.close();
		writer.close();
	}
}